﻿package mortal.game.view.skill.panel.render
{
    import com.gengine.resource.*;
    import com.mui.controls.*;
    import com.mui.core.*;
    import com.mui.display.*;
    import extend.language.*;
    import flash.text.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.view.common.*;
    import mortal.game.view.skill.*;

    public class SkillLearnDescForBasic extends GSprite
    {
        private var _bg:ScaleBitmap;
        private var _titleBg1:GBitmap;
        private var _titleBg2:GBitmap;
        private var _title1:GBitmap;
        private var _title2:GBitmap;
        private var _txtName:GTextFiled;
        private var _txtType:GTextFiled;
        private var _txtLevel:GTextFiled;
        private var _line1:ScaleBitmap;
        private var _line2:ScaleBitmap;
        private var _txtDesc:GTextFiled;
        private var _txtHowToGet:GTextFiled;
        private var _txtNoNeedLevelUp:GTextFiled;
        private var _info:SkillInfo;

        public function SkillLearnDescForBasic()
        {
            return;
        }// end function

        public function updateData(param1:SkillInfo) : void
        {
            var _loc_2:ItemInfo = null;
            if (param1 == null)
            {
                return;
            }
            this._info = param1;
            this._txtName.htmlText = Language.getStringByParam(21073, param1.skillName);
            this._txtType.text = SkillUtil.getSkillUseTypeName(param1.tSkill);
            this._txtDesc.htmlText = SkillUtil.getSkillDesc(param1.tSkill.skillId);
            if (!param1.learned)
            {
                this._txtHowToGet.textColor = 65280;
                this._txtHowToGet.text = Language.getString(21074);
                if (param1.tSkill.needSkillBook > 0)
                {
                    _loc_2 = ItemConfig.instance.getConfig(param1.tSkill.needSkillBook);
                    if (_loc_2 != null && _loc_2.decomposeItems != null && _loc_2.decomposeItems != "")
                    {
                        this._txtHowToGet.htmlText = _loc_2.decomposeItems;
                    }
                    else
                    {
                        this._txtHowToGet.text = Language.getString(21075);
                    }
                }
                else
                {
                    this._txtHowToGet.text = Language.getString(21075);
                }
            }
            else
            {
                this._txtHowToGet.textColor = 15851074;
                this._txtHowToGet.text = Language.getString(20117);
            }
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this.mouseEnabled = true;
            this._bg = UIFactory.bg(0, 0, 199, 474, this);
            this._titleBg1 = UIFactory.bitmap(ImagesConst.SkillTitle_nameBg, 2, 2, this);
            this._titleBg2 = UIFactory.bitmap(ImagesConst.SkillTitle_nameBg, 2, 305, this);
            this._title1 = UIFactory.gBitmap("", this._titleBg1.x + 8, this._titleBg1.y + 8, this);
            this._title2 = UIFactory.gBitmap("", this._titleBg2.x + 8, this._titleBg2.y + 8, this);
            this._txtName = UIFactory.gTextField("", 8, 33, 200, 20, this);
            this._txtName.textColor = 16763265;
            this._txtType = UIFactory.gTextField("", 130, 33, 200, 20, this);
            var _loc_1:* = GlobalStyle.textFormatPutong;
            this._txtLevel = UIFactory.gTextField(Language.getString(21076), 8, 52, 200, 20, this);
            this._txtLevel.htmlText = Language.getString(21077);
            this._line1 = UIFactory.bg(0, 76, 200, 2, this, ImagesConst.SplitLine);
            this._line2 = UIFactory.bg(0, 250, 200, 2, this, ImagesConst.SplitLine);
            _loc_1 = GlobalStyle.textFormatBai;
            _loc_1.leading = 4;
            _loc_1.letterSpacing = 2;
            _loc_1.leading = 4;
            this._txtDesc = UIFactory.gTextField("", 8, 82, 182, 170, this, _loc_1);
            this._txtDesc.multiline = true;
            this._txtDesc.wordWrap = true;
            _loc_1 = GlobalStyle.textFormatPutong;
            _loc_1.leading = 3;
            _loc_1.color = 15590812;
            _loc_1.align = TextFormatAlign.CENTER;
            this._txtHowToGet = UIFactory.gTextField("", 0, 255, 200, 170, this, _loc_1);
            this._txtHowToGet.multiline = true;
            this._txtHowToGet.wordWrap = true;
            this._txtNoNeedLevelUp = UIFactory.gTextField("", 37, 370, 200, 24, this);
            this._txtNoNeedLevelUp.textColor = 125269;
            this._txtNoNeedLevelUp.text = Language.getString(21078);
            LoaderHelp.addResCallBack(ResFileConst.skillPanel, this.skillPanelGot);
            return;
        }// end function

        private function skillPanelGot() : void
        {
            this._title1.bitmapData = GlobalClass.getBitmapData(ImagesConst.SkillPanel_jnjs);
            this._title2.bitmapData = GlobalClass.getBitmapData(ImagesConst.SkillPanel_sjjn);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._bg.dispose(param1);
            this._txtHowToGet.dispose(param1);
            this._txtHowToGet = null;
            this._line1.dispose(param1);
            this._line1 = null;
            this._line2.dispose(param1);
            this._line2 = null;
            this._title1.dispose(param1);
            this._title1 = null;
            this._title2.dispose(param1);
            this._title2 = null;
            this._titleBg1.dispose(param1);
            this._titleBg1 = null;
            this._titleBg2.dispose(param1);
            this._titleBg2 = null;
            this._txtDesc.dispose(param1);
            this._txtDesc = null;
            this._txtLevel.dispose(param1);
            this._txtLevel = null;
            this._txtName.dispose(param1);
            this._txtName = null;
            return;
        }// end function

    }
}
